/*
 * @Author: CodeHare
 * @Date: 2023-09-06 08:44:11
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-03-12 16:42:31
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/app_bar/app_bar_widget.dart';
import 'package:yt_devops/pages/devices/device_list/device_widget.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'child_device_list_controller.dart';

class ChildDeviceListPage extends GetView<ChildDeviceListController> {
  final String? tagName;

  const ChildDeviceListPage({
    Key? key,
    this.tagName,
  }) : super(key: key);

  @override
  ChildDeviceListController get controller =>
      GetInstance().find<ChildDeviceListController>(tag: tagName);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarWidget.withRightActions(
        ResKey.childDevice.tr,
      ),
      body: ListView.builder(
        padding: EdgeInsets.only(bottom: 16.h),
        itemBuilder: (context, index) => DeviceWidget(
          controller.devices[index],
          onItemTaped: controller.toDetail,
          isRealTime: true,
        ),
        itemCount: controller.devices.length,
      ),
    );
  }
}
